package demo9;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class demo9_2 {

    public static void main(String[] args) throws Exception {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
        String strXj = "2023-11-11-0-01-18";
        String strXp = "2023-11-11-0-10-51";
        String sbegin = "2023-11-11-0-0-0-0";
        String send = "2023-11-11-0-10-0";
        Date dataXj = simpleDateFormat.parse(strXj);  // 修复：使用正确的Date类型
        Date dataXp = simpleDateFormat.parse(strXp);  // 修复：使用正确的Date类型
        Date dataBegin = simpleDateFormat.parse(sbegin);
        Date dateEnd = simpleDateFormat.parse(send);
        long timeXj = dataXj.getTime();
        long timeXp = dataXp.getTime();
        long begin = dataBegin.getTime();
        long end = dateEnd.getTime();
        if (begin <= timeXj && timeXj <= end) System.out.println("小贾抢到了~");
        if (begin <= timeXp && timeXp <= end) System.out.println("小皮抢到了~");

    }

}
